package org.jsshbroadcast;

import java.beans.XMLEncoder;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.Serializable;

/**
 *
 * @author Eduardo Folly
 */
public class Config implements Serializable {

    private String dirXMLServ = "."; // Local aonde vão ficar os arquivos XML.
    private int sshTimeOut = 300; // Tempo para time out da conexão ssh.
    private String configLocal = "config.xml.conf";

    public String getDirXMLServ() {
        return dirXMLServ;
    }

    public void setDirXMLServ(String dirXMLServ) {
        this.dirXMLServ = dirXMLServ;
    }

    public int getSshTimeOut() {
        return sshTimeOut;
    }

    public void setSshTimeOut(int sshTimeOut) {
        this.sshTimeOut = sshTimeOut;
    }

    public String getConfigLocal() {
        return configLocal;
    }

    public void Salvar() {
        try {
            XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
                    new FileOutputStream(configLocal)));
            encoder.writeObject(this);
            encoder.flush();
            encoder.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}